﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace CharpPause
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private bool m_Goon = false;
        private void button1_Click(object sender, EventArgs e)
        {
            m_Goon = !m_Goon;
            if (m_Goon)
            {
                button1.Text = "挂起中...";
            }
            else
            {
                button1.Text = "恢复了!";
            }
            int timesnap = int.Parse(textBox2.Text);
            Thread thread = new Thread(()=>{
                var time = System.DateTime.Now;
                //while (m_Goon) 
                //{
                //    ProcessManagercs.ProcessMgr.SuspendProcess(textBox1.Text);
                //    Thread.Sleep(timesnap);
                //    ProcessManagercs.ProcessMgr.ResumeProcess(textBox1.Text);
                //    Thread.Sleep(timesnap/10);
                //}
                ProcessManagercs.ProcessMgr.PoolDealWith(textBox1.Text);
            });
            thread.IsBackground = true;
            thread.Start();
        }
    }
}
